package com.h3c.nem.utils;

import cn.hutool.core.util.ReUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * @author chenyifan
 * @date 2022/6/2 14:33
 */
public class ReUtils {

    /**
     * 手机号码正则
     */
    public static final String JUDGE_MOBILE_PHONE = "^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\\d{8}$";

    /**
     * ${...}正则
     */
    public static final String GET_REPLACE_PATTERN = "\\$\\{(.+?)\\}";


    public static Boolean judgeIsMobilePhone(String content){
        return ReUtil.isMatch(JUDGE_MOBILE_PHONE,content);
    }

    public static List<String> getMatchPattern(String content,String reStr){
        return ReUtil.findAll(reStr, content, 0, new ArrayList<>());
    }
}
